import http from 'lib/http'
import Vue from 'vue'
import { Message } from 'element-ui'

http.interceptors.response.use(
    res => Promise.resolve(res.data), 
    () => {
        Message({
            message: "请求异常",
            type: 'warning'
        })
    }
)


Object.defineProperty(Vue.prototype, "$http", {
    get() {
        return http
    },
    set() {
        console.warn("$http is not allowed to be modified")
    }
})
